namespace Core.Demo10_BreakOutMethodObject
{
	public class Brush
	{
		private readonly IConsolePainter _consolePainter;
		private readonly int _color;
		private readonly int _width;

		public Brush(IConsolePainter consolePainter,int color, int width)
		{
			_consolePainter = consolePainter;
			_color = color;
			_width = width;
		}

		public void Draw(Point[] points)
		{
			for (int i = 0; i < points.Length-1; i++)
			{
				_consolePainter.DrawLine(points[i],points[i+1],_color,_width);		
			}
			_consolePainter.DrawLine(points[points.Length - 1], points[0], _color, _width);		
		}





		public int Color
		{
			get { return _color; }
		}

		public int Width
		{
			get { return _width; }
		}

		public void Draw2(Point[] points)
		{
			new Render().Draw(this,_consolePainter,points);
		}
	}

	public interface IConsolePainter
	{
		void DrawLine(Point startPoint, Point endPoint, int color, int width);
	}

	public class ConsolePainter : IConsolePainter
	{
		public void DrawLine(Point startPoint, Point endPoint, int color, int width)
		{
			//draw the line
		}
	}

	public class Point
	{
		
	}





	public class Render
	{
		public void Draw(Brush brush, IConsolePainter consolePainter, Point[] points)
		{
			for (int i = 0; i < points.Length - 1; i++)
			{
				consolePainter.DrawLine(points[i], points[i + 1], brush.Color, brush.Width);
			}
			consolePainter.DrawLine(points[points.Length - 1], points[0], brush.Color, brush.Width);
		}
	}
}